import request from 'utils/request';
export const getListPatrolPolice = (): Promise<
  Api.resBody['响应«List«警情信息主表»»']['data']
> => {
  return request({
    url: '/patrol-admin/ds-incident-web/listPatrolPolice',
    method: 'get',
  });
};
export const getFindPatrolPolice = (): Promise<
  Api.resBody['响应«List«警情信息主表»»']['data']
> => {
  return request({
    url: '/patrol-admin/project/fight/findPatrolPolice',
    method: 'post',
  });
};
export const getListUavOnline = (
  params: Api.params<'/patrol-admin/project/fight/listUavOnline'>,
): Promise<Api.resBody['响应']['data'][]> => {
  return request({
    url: '/patrol-admin/project/fight/listUavOnline',
    method: 'get',
    params,
  });
};
//
export const getListAllVideos = (): Promise<Api.resBody['响应']['data'][]> => {
  return request({
    url: '/patrol-admin/project/fight/listAllVideos',
    method: 'get',
  });
};
// 获取高点监控tree
export const getHighMonitorsTree = (): Promise<
  Api.resBody['响应']['data'][]
> => {
  return request({
    url: '/patrol-admin/hpVideo/getHighMonitorsTree',
    method: 'get',
  });
};
// 获取指挥员列表
export const findCommand = (data: Api.params<'/patrol-admin/project/fight/findCommand', 'post'>): Promise<
  Api.resBody['响应']['data'][]
> => {
  return request({
    url: '/patrol-admin/project/fight/findCommand',
    method: 'post',
    headers: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    data
  });
};
// 获取范围内的监控
export const getRadiusHighMonitors = (params: {
  lat: string;
  lng: string;
  radius: string;
}): Promise<Api.resBody['响应']['data'][]> => {
  return request({
    url: '/patrol-admin/hpVideo/getRadiusHighMonitors',
    method: 'get',
    params,
  });
};
// 警情添加作战指令
export const addFight = (
  data: Api.params<
    '/patrol-admin/project/fight/addFight',
    'post',
    'body'
  >['dto'],
): Promise<string> => {
  return request({
    url: '/patrol-admin/project/fight/addFight',
    method: 'post',
    data,
  });
};
// 获取警情详细地图数据
export const getFindFigInfo = (
  data: Api.params<'/patrol-admin/project/fight/findFigInfo', 'post'>,
): Promise<Api.resBody['FightInfoDTO']> => {
  return request({
    url: '/patrol-admin/project/fight/findFigInfo',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    },
    data,
    transformRequest(data) {
      let formData = new FormData();
      for (let p in data) {
        formData.append(p, data[p]);
      }
      return formData;
    },
  });
};
